//==============================================================================
#ifndef _CNETWORKPACKET_H_
    #define _CNETWORKPACKET_H_

#include <SDL.h>
#include <string>

#include <net2.h>

#define CNETWORKPACKET_HEADER_SIZE  5
#define CNETWORKPACKET_DATA_SIZE	512

#define MAX_CLIENTS                 128

class CNetworkPacket {
    private:
        Uint8 Header[CNETWORKPACKET_HEADER_SIZE];
        Uint8 Data[CNETWORKPACKET_DATA_SIZE];

        Uint8 Buffer[CNETWORKPACKET_DATA_SIZE];

        unsigned int HeaderBytesRead;
        unsigned int DataBytesRead;

        //Header
        char Message;
        Uint32 DataSize;

    public:
        CNetworkPacket();

        unsigned int ReadHeader(int Socket);

        unsigned int ReadData(int Socket);

        bool NeedsHeader();

        bool IsReady();

    public:
        char GetMessageID();

        Uint8* GetData();

        Uint32 GetDataSize();

        std::string GetDataString();
};

//==============================================================================
#endif
